package day_2022_12_to_3.day;

/**
 * @author haomin
 * @date 2022/12/26 10:50
 **/
public class Day12_26_Num1759 {
    class Solution {
        int mod = (int)Math.pow(10, 9) + 7;
        public int countHomogenous(String s) {
            if(s.length() <= 1) return s.length();

            long ans = 1; int k = 1;
            char[] ch = s.toCharArray();
            for(int i = 1; i < ch.length; ++i) {
                if(ch[i] == ch[i-1])  k ++;
                else k = 1;
                ans += k;
            }
            return (int)(ans % mod);
        }
    }
}